package com.dingreading.cloud.soms.service.impl;

import com.dingreading.cloud.soms.entity.table.CaCallNameImgTableDef;
import com.dingreading.cloud.soms.entity.CaCallNameImg;
import com.dingreading.cloud.soms.mapper.CaCallNameImgMapper;
import com.dingreading.cloud.soms.service.CaCallNameImgService;
import com.mybatisflex.core.query.QueryCondition;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *  服务层实现。
 *
 * @author Administrator
 * @since 2025-08-09
 */
@Service
public class CaCallNameImgServiceImpl extends BaseServiceImpl<CaCallNameImgMapper, CaCallNameImg, CaCallNameImgTableDef> implements CaCallNameImgService {

    @Override
    protected CaCallNameImgTableDef getTable() {
        return CaCallNameImgTableDef.caCallNameImg;
    }

    @Override
    public List<CaCallNameImg> listByCallUid(String storeUid, String callUid) {
        QueryCondition condition = table.storeUid.eq(storeUid)
                .and(table.callUid.eq(callUid));
        return getMapper().selectListByCondition(condition);
    }

    @Override
    public int deleteImg(String storeUid, String uid) {
        return getMapper().deleteByCondition(table.uid.eq(uid));
    }

    @Override
    public CaCallNameImg getByUid(String storeUid, String uid) {
        QueryCondition condition = table.storeUid.eq(storeUid)
                .and(table.uid.eq(uid));
       return getMapper().selectOneByCondition(condition);
    }
}
